<!--行业信息-->
<div class="tab-pane fade" id="tab-industry" >
	<!--3节能公司-->
	<div class="panel panel-default">
		<div class="panel-body">
			<div class="form-horizontal">

				<div class="form-group">
					<label class="col-xs-3 control-label no_padding_right">有无银行资信信息:</label>
					<div class="col-xs-6">
						<label class="radio-inline">
							<input name="has_bank_credit_info" id="" value="0" checked="" type="radio">
							无
						</label>
						<label class="radio-inline">
							<input name="has_bank_credit_info" id="" value="1" type="radio">
							有
						</label>
					</div>
				</div>

				<div class="form-group hide bank_credit">
					<label for="inputEmail" class="col-xs-3 control-label no_padding_right">银行资信等级:</label>
					<div class="col-xs-6">
						<input class="form-control input_size" name="bank_credit_level" id="inputEmail" placeholder="" type="text">
					</div>
				</div>

				<div class="form-group hide bank_credit">
					<label for="inputEmail" class="col-lg-3 control-label no_padding_right">银行资信证书</label>
					<div class="col-lg-6">
						<input type="file" name="imgFile" class="uploadImage">
						<input type="hidden" name="bank_credit_copy" class="hiddenName">
						<span class="fileName"></span>
					</div>
				</div>

				<div class="form-group hide bank_credit">
					<label for="inputEmail" class="col-xs-3 control-label no_padding_right">银行贷款卡卡号:</label>
					<div class="col-xs-6">
						<input class="form-control input_size" name="bank_card_code" id="inputEmail" placeholder="" type="text">
					</div>
				</div>


				<div class="form-group">
					<label for="inputEmail" class="col-xs-3 control-label no_padding_right">现有总资产:</label>
					<div class="col-xs-6">
						<input class="form-control input_size" name="total_capital" id="inputEmail" placeholder="" type="text">
					</div>
				</div>

				<div class="form-group">
					<label for="inputEmail" class="col-xs-3 control-label no_padding_right">净资产:</label>
					<div class="col-xs-6">
						<input class="form-control input_size" name="net_capital" id="inputEmail" placeholder="" type="text">
					</div>
				</div>

				<div class="form-group">
					<label for="inputEmail" class="col-xs-3 control-label no_padding_right">产业负债率:</label>
					<div class="col-xs-6">
						<input class="form-control input_size" name="liabilities_rate" autocomplete="of" id="inputEmail" placeholder="" type="text">
					</div>
				</div>

				<div class="form-group">
					<label for="textArea" class="col-xs-3 control-label no_padding_right">需要说明的其他情况:</label>
					<div class="col-xs-6">
						<textarea class="form-control text_size" rows="3" name="note" id="textArea"></textarea>
						<span class="help-block"></span>
					</div>
				</div>

				<div class="form-group">
					<div class="col-xs-12 text-center">
						<button type="button" id="sub" class="btn btn-primary ">提交</button>
					</div>
			    </div>
			</div>
		</div>
	</div>
</div>



<script type="text/javascript">

var hasCreditInfo = false;



var industry = {};
var loadIndustry = true;
$("#showIndustry").click(function(){
	if(loadIndustry){
		$.getq(que, "get_user_industry", {uid :uid}, function (data){
			console.log(data);
			if(data.success){
				$.each(data.data, function (k, v){
					$("#tab-industry input[type='text'][name="+k+"]").val(v);
					$("#tab-industry input[type='hidden'][name="+k+"]").val(v);
				})

				$("#tab-industry textarea[name='note']").val(data.data.note);
				$("#tab-industry input[type='radio'][value="+data.data.has_bank_credit_info+"]").attr("checked", "checked");

				if(data.data.has_bank_credit_info == 1)
				{
					hasCreditInfo = true;
					$(".bank_credit").removeClass("hide");
				}
				loadIndustry = false;

			}
		})
	}
})

$(".uploadImage").AjaxFileUpload({
	path : url + "upload",
	onComplete : function(filename){
			$(this).siblings(".hiddenName").val(filename.filename);
			$(this).siblings(".fileName").html(filename.filename);
		}
	});


$("input[type=radio]").bind("change", function(){
	if($(this).attr("value") == 1){
		hasCreditInfo = true;
		$(".bank_credit").removeClass("hide");
	}else{
		hasCreditInfo = false;
		$('input[name=bank_credit_level]').val('');
		$('input[name=bank_credit_copy]').val('');
		$('input[name=bank_card_code]').val('');
		$(".bank_credit").addClass("hide");
	}
});


$("#tab-industry #sub").click(function(){
	var has_bank_credit_info = $("input[name='has_bank_credit_info']:checked").val().trim();
	var bank_credit_level = $("input[name='bank_credit_level']").val().trim();
	var bank_credit_copy = $("input[name='bank_credit_copy']").val().trim();
	var bank_card_code = $("input[name='bank_card_code']").val().trim();
	var total_capital = $("input[name='total_capital']").val().trim();
	var net_capital = $("input[name='net_capital']").val().trim();
	var liabilities_rate = $("input[name='liabilities_rate']").val().trim();
	var note = $("textarea[name='note']").val().trim();

	if(has_bank_credit_info == 0)
	{
		if (has_bank_credit_info == '' || total_capital == '' || net_capital == '' || liabilities_rate == '' )
		{
			warning('','必填信息不能为空');
			return false;
		}
	}
	else
	{
		if (has_bank_credit_info == '' || bank_credit_level == '' || bank_credit_copy == '' || bank_card_code == '' || total_capital == '' || net_capital == '' || liabilities_rate == '')
		{
			warning('','必填信息不能为空');
			return false;
		}
	}
	$.post("update_industry_device", {
	has_bank_credit_info : has_bank_credit_info,
	bank_credit_level : bank_credit_level,
	bank_credit_copy : bank_credit_copy,
	bank_card_code : bank_card_code,
	total_capital : total_capital,
	net_capital : net_capital,
	liabilities_rate : liabilities_rate,
	note : note,
	uid : uid
	},function (data){
		if(data.success){
			success("", "提交成功");
			setTimeout(function(){
				// window.location.href="industryinfo";
			}, 2000)
		}else{
			warning("", data.msg);
		}
	})
})



</script>